import Priority
import User

public class Task {

  Long id;
  String name;
  String description;
  Date date;
  User user
  Priority priority

  static hasOne = [user: User, priority: Priority]
  static fetchMode = [priority: 'eager']

  static def constraints = {
    id(blank: false, unique: true)
    name(size: 1..50, blank: false)
    user(blank: false)
    priority(blank: false)
    date(min:new Date(),max: new Date() + 1)
  }
}